package com.ruoyi;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.Environment;
import java.net.InetAddress;
import java.net.UnknownHostException;

/**
 * 启动程序
 * 
 * @author ruoyi
 */
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
public class RuoYiApplication
{
    public static void main(String[] args)
    {
        ConfigurableApplicationContext application = SpringApplication.run(RuoYiApplication.class, args);
        try {
            Environment env = application.getEnvironment();
            String ip = InetAddress.getLocalHost().getHostAddress();
            String port = env.getProperty("server.port");
            String active = env.getProperty("spring.profiles.active");
            String maxFileSize = env.getProperty("spring.servlet.multipart.max-file-size"); //最大文件大小
            String maxRequestSize = env.getProperty("spring.servlet.multipart.max-request-size"); //最大请求大小
            System.out.println("\n----------------------------------------------------------\n\t" +
                    "(♥◠‿◠)ﾉﾞ  mwj - 若依启动成功   ლ(´ڡ`ლ)ﾞ :\n\t" +
                    "Doc: \t\thttp://" + ip + ":" + port + "/doc.html\n\t" +
                    "spring-profiles-active: \t\t" + active + "\n\t" +
                    "max-file-size: \t\t" + maxFileSize + "\n\t" +
                    "max-request-size: \t\t" + maxRequestSize + "\n" +
                    "----------------------------------------------------------");
        } catch (UnknownHostException e) {
            e.printStackTrace();
        }
    }
}
